﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"-->
<!--#include file="md5.Asp" -->

<% 
exec="select * from admin" 
set rs=server.createobject("adodb.recordset") 
rs.open exec,conn,1,1 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改密码</title>
<link href="images/style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">
function check(){
     if (document.add.form_password.value.length=="")
     {
           alert("密码不能为空!");
           document.add.form_password.focus();
           return false;
     }
     
     if (document.add.form_password.value!=document.add.form_password2.value)
     {
           alert("两次输入密码不一致，请重新输入！");
           document.add.form_password2.focus();
           return false;
     }
           return true;
}

</script></head>
<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30" class="head"><strong>修改密码</strong></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="8" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
      <form action="admin_password.asp?update=ok" method="post"  name="add" id="add" onsubmit="return check()">
        
        <tr>
          <td width="13%">登陆帐号</td>
          <td width="59%"><input name="form_admin" type="text" value="<%=rs("admin")%>" size="30" /></td>
        </tr>
        
        <tr>
          <td>新密码</td>
          <td><input name="form_password" type="text" id="form_password" size="30" /></td>
        </tr>
        <tr>
          <td>确认密码</td>
          <td><input name="form_password2" type="text" id="form_password2" size="30" /></td>
        </tr>
        <tr>
          <td colspan="2"><input type="submit" name="button" id="button" value="修改密码" />
              <input type="reset" name="button2" id="button2" value="重置" /></td>
        </tr>
      </form>
    </table></td>
  </tr>
</table>
</body>
</html>

<% 
if Request.QueryString("update")="ok" then
	
	sql="select * from admin"
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,1,3
	
	rs("admin")=request.form("form_admin")
	
	rs("password")=md5(request.form("form_password"))
	 
	rs.update 
	rs.close 
	response.Write("<script language=""javascript"">alert(""登陆帐号及密码修改成功，请牢记您帐号及新密码！"");window.location.href='admin_password.asp';</script>")
end if 
%> 


